home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C & C++ Multimedia Cyber Classroom
/
C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso
/
src
/
fig16_28.jar
/
Ch16
/
Fig16_28
/
Fig16_28.cpp
Wrap
C/C++ Source or Header
|
1997-11-10
|
704b
|
27 lines
// Fig. 16.28: fig16_28.cpp
// Using strchr
#include <iostream.h>
#include <string.h>
int main()
{
char *string = "This is a test";
char character1 = 'a', character2 = 'z';
if ( strchr( string, character1 ) != NULL )
cout << '\'' << character1 << "' was found in \""
<< string << "\".\n";
else
cout << '\'' << character1 << "' was not found in \""
<< string << "\".\n";
if ( strchr( string, character2 ) != NULL )
cout << '\'' << character2 << "' was found in \""
<< string << "\".\n";
else
cout << '\'' << character2 << "' was not found in \""
<< string << "\"." << endl;
return 0;
}